#ifndef _SOLVER_UTIL_H_
#define _SOLVER_UTIL_H_

#include <surftrack.h>

typedef void (*mvFun)(double*, double**, int);

void assemblyBoundaryVector(SurfTrack* surf, double** b);

void biCGStab(mvFun mvProduct, double* b, double** x, int n, int max_it, double tol);

inline double vectorInnerProduct(double* a, double* b, int n);
inline void vectorMinus(double* a, double* b, double** s, int n);
int getIndexLS(int i, int j, int n);
inline void vectorCopy(double* src, double** trg, int n);
inline void vectorAmplititude(double* src, double scalar, double** trg, int n);
inline void xUpdate(double* src, double scalar1, double* vector1, double scalar2, double* vector2, double** trg, int n);
inline void vectorClear(double** x, int n);

inline void getEigenDecomposition(double* A, double** pval, double** pvec);

#endif
